import Vue from "vue"
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: () => import("../views/Layout.vue"),
    children: [
      {
        path: '',
        name: 'Home',
        component: () => import("../views/Home.vue"),
        meta:{
            isLogin: true
        },
        children:[
          {
            path: "index",
            name: "Index",
            component:() => import("../views/main/Index.vue"),
            meta:{
              isLogin: true
            },
          },
          {
              path: "house",
              name: "House",
              component:() => import("../views/main/House.vue"),
              meta:{
                isLogin: true
              },
          },
          {
            path: "maintenance",
            name: "Maintenance",
            component:() => import("../views/main/Maintenance.vue"),
            meta:{
              isLogin: true
            },
          },
          {
            path: "notice",
            name: "Notice",
            component:() => import("../views/main/Notice.vue"),
            meta:{
              isLogin: true
            },
          },
          {
            path: "owner",
            name: "Owner",
            component:() => import("../views/main/Owner.vue"),
            meta:{
              isLogin: true
            },
          },
          {
            path: "parkingLot",
            name: "ParkingLot",
            component:() => import("../views/main/ParkingLot.vue"),
            meta:{
              isLogin: true
            },
          },
          {
            path: "payFees",
            name: "PayFees",
            component:() => import("../views/main/PayFees.vue"),
            meta:{
              isLogin: true
            },
          },
          {
            path: "operateLog",
            name: "OperateLog",
            component:() => import("../views/main/OperateLog.vue"),
            meta:{
              isLogin: true
            },
          },
          {
            path: "hostel",
            name: "Hostel",
            component:() => import("../views/main/Hostel.vue"),
            meta:{
              isLogin: true
            },
          },
          {
            path: "complaint",
            name: "Complaint",
            component:() => import("../views/main/Complaint.vue"),
            meta:{
              isLogin: true
            },
          },
        ]
      },
    ],
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import("../views/Register.vue")
  },
  {
    path: '/forget',
    name: 'Forget',
    component: () => import("../views/Forget.vue")
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import("../views/Login.vue")
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
